/*
 * HTTPServer.h
 *
 *   Created on: 2010-2-11     
 *  Description: 基于HTTP协议的json_rpc服务器
 *    Copyright: 2010 @ ICT Li Heyuan
 */

#ifndef HTTPSERVER_H_
#define HTTPSERVER_H_

#include "TcpServer.h"
#include "../conn/HttpConn.h"

class HttpServer: public TcpServer
{
public:

	/*构造函数，与TcpServer相同
	 *
	 */
	HttpServer(unsigned int port, int backlog = 20, const std::string ip = "") :
		TcpServer(port, backlog, ip)
	{
		//Http服务器中,默认server先关闭
		_closeFirst = true;
	}

	/* 析构，交给~TcpServer()处理
	 */
	~HttpServer()
	{
	}

	/* 返回一个HttpConn，HttpServer = TcpServer+HttpConn
	 * @return 一个HttpConn
	 */
	Conn* newConn(int sock, const EasyAddr &addr)
	{
		return new HttpConn(this, sock, addr);
	}

protected:
	//Conn继承自TcpServer
};

#endif /* HTTPSERVER_H_ */
